#include"comm.h"

int main()
{
  key_t key=ftok(PATH_NAME,PROJ_ID);
  if(key<0)
  {
    perror("creat fail\n");
    return 1;
  }
  int shmid=shmget(key,SIZE,IPC_CREAT|IPC_EXCL|0644);
  if(shmid<0)
  {
    perror("shmid error\n");
    return 2;
  }
  char*mem=(char*)shmat(shmid,NULL,0);
  int num=100;
  while(num--)
  {
    printf("CLient#:%s\n",mem);
    sleep(1);
  }
  shmdt(mem);
  shmctl(shmid,IPC_RMID,0);
  return 0;
}
